/*
 * Author: nicolas.bredeche(@)lri.fr
 * Created on 20 janv. 2006
 * 
 */

package picoevo.gp.representation;

import java.util.ArrayList;

import picoevo.core.representation.Individual;

abstract public class Element_Node_TreeGP_Operator extends Element_Node_TreeGP {

	public Element_Node_TreeGP_Operator(Individual __individualOwner, ArrayList __elementLevelOperatorList) {
		super(__individualOwner, __elementLevelOperatorList);
	}

	@Override
	public ArrayList getNonTerminalElements(ArrayList __list) {
		for (int i = 0; i != this.getSuccessors().size(); i++)
			((Element_Node_TreeGP) this.getSuccessors().get(i)).getNonTerminalElements(__list);
		__list.add(this);
		return (__list); // add self and continue
	}

	@Override
	public ArrayList getTerminalElements(ArrayList __list) {
		for (int i = 0; i != this.getSuccessors().size(); i++)
			((Element_Node_TreeGP) this.getSuccessors().get(i)).getTerminalElements(__list);
		return (__list); // continue
	}

	@Override
	public ArrayList getAllElements(ArrayList __list) {
		for (int i = 0; i != this.getSuccessors().size(); i++)
			((Element_Node_TreeGP) this.getSuccessors().get(i)).getAllElements(__list);
		__list.add(this);
		return (__list); // add self and continue
	}

}
